package com.frank.loadinglibrary.special.dot.circle;

import ohos.agp.render.Canvas;
import ohos.agp.render.Paint;
import ohos.agp.utils.Color;

/**
 * @author SUQI
 * @date 2021/5/26
 * @description
 **/
public class WolfCircle extends BaseCircle {
    private float mOriginR;
    private static final float DEGREE_360 = 360f;

    public WolfCircle() {

    }

    public WolfCircle(float x, float y, float radius, int degree) {
        super(x, y, radius, degree);
        mOriginR = radius;
    }

    public WolfCircle(float x, float y, float radius, float degree, Color color) {
        super(x, y, radius, degree, color);
    }

    @Override
    public void draw(Canvas canvas, Paint paint, float cx, float cy) {
        canvas.save();
        canvas.rotate(degree, cx, cy);
        canvas.drawCircle(x, y, radius, paint);
        canvas.restore();
    }

    public void runTo(float degree) {
        if (degree < DEGREE_360) {
            this.degree = degree;
        } else {
            this.degree = 0;
        }
    }

    @Override
    public void smaller(float size) {
        radius = mOriginR - size;
    }

    @Override
    public void bigger(float size) {
        radius = mOriginR + size;
    }

    public float getmOriginR() {
        return mOriginR;
    }

    public void setmOriginR(float mOriginR) {
        this.mOriginR = mOriginR;
    }
}
